/*
 * @Author: peng.chen2 peng.chen2@rt-mart.com
 * @Date: 2025-07-24 10:30:00
 * @LastEditors: peng.chen2
 * @LastEditTime: 2025-07-31 11:09:30
 * @FilePath: /rt-monitoring/src/service/types.ts
 * @Description: API 请求相关类型定义
 */

// 通用 API 响应结构
export interface ApiResponse<T = any> {
  code: number
  msg: string
  data: T
  success: boolean
  timestamp?: number
}

// 分页请求参数
export interface PaginationParams {
  page?: number
  pageSize?: number
  total?: number
}

// 分页响应数据
export interface PaginationResponse<T> {
  list: T[]
  pagination: {
    current: number
    pageSize: number
    total: number
    totalPages: number
  }
}

// 请求配置
export interface RequestConfig {
  timeout?: number
  headers?: Record<string, string>
  params?: Record<string, any>
  data?: any
}

// HTTP 方法类型
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'

// 请求拦截器配置
export interface RequestInterceptor {
  onFulfilled?: (config: any) => any
  onRejected?: (error: any) => any
}

// 响应拦截器配置
export interface ResponseInterceptor {
  onFulfilled?: (response: any) => any
  onRejected?: (error: any) => any
}